<template>
  <div>
 <el-card class="box-card">
  <div slot="header" class="clearfix">
    <span >评论</span>
    <el-button style="float: right; padding: 3px 0" type="text">点赞</el-button>
  </div>
  <div v-for="o in obj.data" :key="o" class="text item">
    {{o.userName}} {{JSON.stringify(o.commentInfoBeans[0].comInfo)}} {{JSON.stringify(o.commentInfoBeans[0].comCount)}}
    <div>
        <div>
            <el-button @click="isShow()">
                <img  v-if="falg" src="/api/static/img/1.png">
                <img v-else src="/api/static/img/2.png">
            </el-button>
        </div>   
    </div>
    
  </div>

</el-card>

  </div>
</template>

<script>
import {showAlls,updateAdd} from '../service/user'

export default {
   data(){
       return{
           obj:[],
           token:"",
           falg:true
       }
   },
   
   methods:{
       async findAll(){
            let objs = await showAlls();
            this.obj = objs;
        //    alert(JSON.stringify(this.obj.data))
         this.token = this.$cookies.get('token')
         alert(JSON.stringify(this.obj.data))
       },
       async isShow(){
           if(this.falg==true){
               await updateAdd(this.token.userId,);
               this.falg = false;
           }else if(this.falg == false){
               this.falg = true;
           }
       }

   },
   async created(){
       this.findAll();
   }

}

</script>

<style>
 .text {
    font-size: 14px;
  }

  .item {
    margin-bottom: 18px;
  }

  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }

  .box-card {
    width: 480px;
  }


  
</style>